package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.WmsSuppliers;
import com.ruoyi.system.domain.vo.SelectVo;
import com.ruoyi.system.mapper.WmsSuppliersMapper;
import com.ruoyi.system.service.IWmsSuppliersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 供应商信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-06-12
 */
@Service
public class WmsSuppliersServiceImpl implements IWmsSuppliersService
{
    @Autowired
    private WmsSuppliersMapper wmsSuppliersMapper;

    /**
     * 查询供应商信息
     *
     * @param id 供应商信息主键
     * @return 供应商信息
     */
    @Override
    public WmsSuppliers selectWmsSuppliersById(Long id)
    {
        return wmsSuppliersMapper.selectWmsSuppliersById(id);
    }

    /**
     * 查询供应商信息列表
     *
     * @param wmsSuppliers 供应商信息
     * @return 供应商信息
     */
    @Override
    public TableDataInfo<WmsSuppliers> selectWmsSuppliersList(WmsSuppliers wmsSuppliers, PageQuery pageQuery)
    {
        Page<WmsSuppliers> page = wmsSuppliersMapper.selectWmsSuppliersList(pageQuery.build(),wmsSuppliers);
        return TableDataInfo.build(page);
    }

    /**
     * 新增供应商信息
     *
     * @param wmsSuppliers 供应商信息
     * @return 结果
     */
    @Override
    public int insertWmsSuppliers(WmsSuppliers wmsSuppliers)
    {
        return wmsSuppliersMapper.insertWmsSuppliers(wmsSuppliers);
    }

    /**
     * 修改供应商信息
     *
     * @param wmsSuppliers 供应商信息
     * @return 结果
     */
    @Override
    public int updateWmsSuppliers(WmsSuppliers wmsSuppliers)
    {
        return wmsSuppliersMapper.updateWmsSuppliers(wmsSuppliers);
    }

    /**
     * 批量删除供应商信息
     *
     * @param ids 需要删除的供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteWmsSuppliersByIds(Long[] ids)
    {
        return wmsSuppliersMapper.deleteWmsSuppliersByIds(ids);
    }

    /**
     * 删除供应商信息信息
     *
     * @param id 供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteWmsSuppliersById(Long id)
    {
        return wmsSuppliersMapper.deleteWmsSuppliersById(id);
    }

    @Override
    public List<SelectVo> getSupplierSelect(){
        return wmsSuppliersMapper.getSupplierSelect();
    }
}
